<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<div id="app">
    <span>{{message}}</span>
</div>


<script src="../js/vue.js"></script>
<script src="../js/axios.js"></script>
<script>

    // function getUserAccount() {
    //     return axios.get('http://localhost:8972/test?ID=getUserAccount');
    // }
    //
    // function getUserPermissions() {
    //     return axios.get('http://localhost:8972/test?ID=getUserPermissions');
    // }


    const vm = new Vue({
        el: "#app",
        data: {
            message: "hello vue",
            title: "fa"
        },
        methods: {
            getUserAccount() {
                return axios.get('http://localhost:8972/test?ID=getUserAccount');
            },
            getUserPermissions() {
                return axios.get('http://localhost:8972/test?ID=getUserPermissions');
            }
        },
        //后挂载
        mounted: function () {
            axios.post('http://localhost:8972/test', {
                name: '张三',
                id: 23,
                date:new Date(),
                timestamp:new Date()
            })
                .then(function (response) {
                    console.log(response);
                })
                .catch(function (error) {
                    console.log(error);
                });
        },
        //先创建
        created: function () {
            axios.all([this.getUserAccount(), this.getUserPermissions()])
                .then(axios.spread(function (acct, perms) {
                    // 两个请求现在都执行完成
                    console.log(acct);
                    console.log(perms)
                }));
        },

    })


</script>
</body>
</html>